package com.itheima.io1.mybyteststream2;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @author zhangbaiyan
 * @date 2024-09-20 13:03
 * @description:
 * @version:
 */
public class kaobei {
    public static void main(String[] args) throws IOException {
        /*
        练习:
            文件拷贝
            把D:\itheima\movie.mp4
        注意:
            选择一个比较小的文件,不要太大
         */


        //1.创建对象
        FileInputStream fis = new FileInputStream("C:\\Users\\17685\\Desktop\\截图20240919145018.png");
        FileOutputStream fos = new FileOutputStream("f.png");
        //2.拷贝
        //核心思想:边读边写
        int len;
        while((len=fis.read())!=-1){
            fos.write(len);
        }
        fos.close();
        fis.close();
    }
}
